package applications.insurancecard.ui.lib;

import java.awt.Color;
import java.awt.Font;

import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import org.objectweb.fractal.fraclet.annotations.Component;
import org.objectweb.fractal.fraclet.annotations.Interface;

@Component(provides = {@Interface(name = "jPanelItf", signature = org.objectweb.fractal.swing.JPanelItf.class), @Interface(name = "jPanelAttributes", signature = org.objectweb.fractal.swing.JPanelAttributes.class), @Interface(name = "uicontainerservice", signature = ontocompo.api.UIContainerService.class), @Interface(name = "ontocompointrospection", signature = ontocompo.api.OntoCompoIntrospection.class)})
public class SocialInfoMedicalReferentValue extends JPanel implements /*ContainerService,*/ org.objectweb.fractal.swing.JPanelItf, org.objectweb.fractal.swing.JPanelAttributes, ontocompo.api.UIContainerService, ontocompo.api.OntoCompoIntrospection {

	private String uid;
	private org.objectweb.fractal.api.Component c;
	
	
	private JLabel lbl;
	
	public SocialInfoMedicalReferentValue() {
		super();
		this.uid = "applications.insurancecard.ui.lib.SocialInfoMedicalReferentValue";
		System.out.println(this.toString() + " created");
		
		//this.init();
	}
	
	public void init() {
		this.setBackground(Color.white);
		
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
			
		lbl  = createTd("###");
			
		lbl.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
			
		this.add(lbl);
	}
	
	protected JLabel createTd(String txt)
	{
		JLabel result = new JLabel(txt);
		result.setFont(result.getFont().deriveFont(Font.PLAIN));
		result.setHorizontalAlignment(SwingConstants.LEFT);
		return result;
	}
	
//	@Override
	public JComponent getComponentItSelf() {
		// TODO Auto-generated method stub
		return this;
	}

	@Override
	public String getUid() {
		// TODO Auto-generated method stub
		return this.uid;
	}

	@Override
	public void setUid(String uid) {
		// TODO Auto-generated method stub
		this.uid = uid;
	}
	
	public String toString() {
		return "SocialInfoMedicalReferentValue";
	}

	@Override
	public org.objectweb.fractal.api.Component getFractalComponent() {
		// TODO Auto-generated method stub
		return this.c;
	}

	@Override
	public void setFractalComponent(org.objectweb.fractal.api.Component c) {
		// TODO Auto-generated method stub
		this.c = c;
	}

	@Override
	public void update(Object o) {
		// TODO Auto-generated method stub
		String s = (String) o;
		this.lbl.setText(s);
		this.getParent().validate();
	}

}